<?php

class template_ajax_link extends theme
{

	protected function head()
	{
	$menu_id = $this->get('menu_id');
	$application_list = $this->get('application_list');
	$controller_list = $this->get('controller_list');
	?>
<link type="text/css" rel="stylesheet" href="templates/menu/css/ajax_link.css" />
	
<script type="text/javascript" language="javascript" src="templates/menu/js/ajax_link.js"></script>
<script type="text/javascript" language="javascript">
var g_iMenuID = <?php echo $menu_id; ?>;
var g_oApplication = new Object();
var g_oTask = new Object();
<?php
if(count( $application_list )!=0)
{
	foreach($application_list as $application)
	{
		echo 'g_oApplication['.$application->application_id.']='.json_encode($application).";\r\n";
	}
}

if(count( $controller_list )!=0)
{
	foreach($controller_list as $controller)
	{
		echo 'g_oTask['.$controller->application_id.']="'.$controller->tasks."\";\r\n";
	}
}
?>
</script>

	<?php
	}

	protected function body()
	{
		$menu_id = $this->get('menu_id');
		$application_list = $this->get('application_list');
		$controller_list = $this->get('controller_list');
		?>
		
<p class="title"><?php echo $this->get_title(); ?></p>

<div id="link">
	<p>
		<label class="item-title">请选择应用:</label>
		<select id="application" onchange="javascript:changeApplication();">
		<option value="-1">请选择</option>
		<?php
		foreach($application_list as $application)
		{
		?>
		<option value="<?php echo $application->application_id; ?>"><?php echo $application->name; ?></option>
		<?php
		}
		?>
		</select>
	</p>
	
	<p>
		<label class="item-title">请选择任务: </label>
		<select id="task" onchange="javascript:changeTask();">
		<option value="-1">请先选择控制器</option>
		</select>
	</p>
	
	<p id="content-wrap"></p>
	
	<p><label class="item-title">参数: </label> <input type="text" id="param" size="20" maxlength="120" /></p>
	<p><label class="item-title">&nbsp;</label> <input type="button" value="保存" onclick="javascript:save();" /></p>

</div>
		<?php
		
	}	

}
?>